package space.jevin.jevinboot.controller;
import space.jevin.jevinboot.constant.StatusFlagEnum;
import java.time.LocalDateTime;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import space.jevin.jevinboot.entity.App;
import space.jevin.jevinboot.mapper.AppMapper;

/**
 * 应用信息(App)表控制层
 *
 * @author zhangjiehang
 * @since 2021-05-17 10:21:43
 */
@RestController
@RequestMapping("app")
public class AppController {
    /**
     * 服务对象
     */
    @Autowired
    private AppMapper appMapper;

    @GetMapping("/getAppById")
    public App getApp(Long id){
        return appMapper.selectById(id);
    }

    @GetMapping("/insertApp")
    public Integer getApp(){
        App app = new App();
        app.setName("test");
        app.setType(0);
        app.setNum("55f600bf9e6b4ee1");
        app.setSecret("$2a$10$VVTCRR5UVjOgX96C7.RHUOGnrfaFDnsfqQNV0t.L0IuSOoPdZugzsadas");
        app.setSecretSalt("1617e48fd4714e7d");
        app.setRemark("token6秒过期");
        app.setStatusFlag(StatusFlagEnum.START);
        app.setInsertTimestamp(LocalDateTime.now());
        app.setUpdateTimestamp(LocalDateTime.now());
        return appMapper.insert(app);
    }


}
